_realname=verilator
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.884
pkgrel=1
pkgdesc="The fastest free Verilog HDL simulator (mingw-w64)"
arch=('any')
url="http://www.veripool.org/projects/verilator/wiki/Intro"
license=("LGPL")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "flex")
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs")

source=("http://www.veripool.org/ftp/${_realname}-${pkgver}.tgz")
md5sums=('cfc86a593aba5ec68dd2905b33edc905')

build() {
  [[ -d "build-${MINGW_CHOST}" ]] && rm -rf "build-${MINGW_CHOST}"
  mv "verilator-${pkgver}" "build-${MINGW_CHOST}"
  cd "build-${MINGW_CHOST}"
	
  cp /usr/include/FlexLexer.h src/
	
  ./configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST}

  make
}

package() {
  cd "build-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install
}
